<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <div >接收到参数：{{$route.params.class}} -  {{$route.name}}<br /><!-- $route 接收request请求字串 -->
    {{$route.params.addr}}</div>
  </div>
  
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to hello page'
    }
  },
  //路由进去前
  beforeRouteEnter:(to, from, next)=> {
     console.log('路由准备进入路由模板进来了');
     next();
  },
    //路由离开
  afterRouteEnter(to, from, next){
    console.log('准备离开路由模板');
    next();
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
